
var lisImg = document.querySelectorAll('.imgBox li');
var lisTab = document.querySelectorAll('.tabBox li');
var showIndex=2;

for( var i = 0; i < lisTab.length; i++ ){
    lisTab[i].index = i;
    lisTab[i].onmouseover = function(){
        showIndex=this.index;
        show(this.index);
    }
}
function show(num){
    for(var k=0;k<lisTab.length;k++){
        lisImg[k].className='';
        lisTab[k].className='';
    }
    lisImg[num].className='active';
    lisTab[num].className='current';
}
show(showIndex);

var timer;
timer=setInterval(function () {
    showIndex++;
    if(showIndex>=lisTab.length){
        showIndex=0;
    }
    show(showIndex);
},1500)

var bannerBox=document.querySelector('.bannerBox');
bannerBox.onmouseover=function () {
    clearInterval(timer);
}
bannerBox.onmouseleave=function () {
    timer=setInterval(function () {
        showIndex++;
        if(showIndex>=lisTab.length){
            showIndex=0;
        }
        show(showIndex);
    },1500)
}

chengyuan.onclick=function () {

    personal.style.top=100+'px'
    setTimeout(function () {
        personal.style.top=70+'px'
    },500)
}
del.onclick=function () {
    personal.style.top=100+'px'
    setTimeout(function () {
        personal.style.top=-800+'px'
    },500)
}

function getScrollTop(){
    var scrollTop=0;
    if(document.documentElement&&document.documentElement.scrollTop){
        scrollTop=document.documentElement.scrollTop;
    }else if(document.body){
        scrollTop=document.body.scrollTop;
    }
    return scrollTop;
}

var arr1=document.getElementsByClassName("feng")
var arr2=document.getElementsByClassName("fengcai")
for(var i=0;i<arr1.length;i++){
    arr1[i].index=i;
    arr1[i].onclick=function () {
        var x=getScrollTop();
        wenzhang.style.display='none'
        for (var j=0;j<arr2.length;j++){
            arr2[j].style.display='none'

        }
        for(var k=0;k<arr1.length;k++){
            arr1[k].style.color='blue'
            arr1[k].style.fontSize=18+'px'
        }
        var timer=setInterval(function () {
            x+=40;
            if(x>=510){
                x=510
                clearInterval(timer)
            }
            window.scrollTo(0,x)
        },16.7)
        arr2[this.index].style.display='block'
        arr1[this.index].style.color='red'
        arr1[this.index].style.fontSize=22+'px'
    }
}
